package com.blb.zy_community.controller;

import com.blb.zy_community.entity.ResponseResult;
import com.blb.zy_community.entity.SysArea;
import com.blb.zy_community.service.ISysAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 区域表 前端控制器
 * </p>
 *
 * @author 二组
 * @since 2023-06-18
 */
@RestController
@CrossOrigin
public class SysAreaController {
    @Autowired
    private ISysAreaService sysAreaService;

    @GetMapping("/area-tree")
    public ResponseResult<String> getAreaTree(){
        List<SysArea> sysAreaList = sysAreaService.selectChildAreaTreeByParentId(0L);
        return ResponseResult.ok(sysAreaList);
    }
}
